package com.example.controller;

import com.example.domain.vo.SysPermissionVo;
import com.example.respose.Result;
import com.example.service.ISysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ljs
 * @date 2025/7/26
 */
@RestController
@RequestMapping("sys")
public class SysPermissionController {

    @Autowired
    private ISysPermissionService sysPermissionService;

    @GetMapping("/perms")
    @PreAuthorize("hasAuthority('api:permission:list')")
    public Result<SysPermissionVo> getPermission() {
        return Result.success(sysPermissionService.getPermission());
    }
}
